#ifndef FILE_H
#define FILE_H

#include <string>
#include <Windows.h>

using std::wstring;

const size_t g_data_piece_size = 65536;

class File
  {
  public:
    File();
    File(const wstring& i_name);
    File(const File& i_other);
    File(const File&& i_ref);
    ~File();

    wstring GetName() const;
    unsigned long long GetSize() const;
    size_t GetDataPieceSize() const;

    bool IsValid() const;

    int Delete();

    bool IsReading() const;
    size_t GetBytesDone() const;

    bool operator ==(const File& i_other) const;
    bool operator < (const File& i_other) const;
  private:
    bool m_is_valid;
    wstring m_file_name;
    HANDLE mh_file;
    char* mp_data_piece;
    size_t m_data_piece_size;
    unsigned long long m_file_size;
    
    // true if file data is being read now
    mutable bool m_is_reading;
    // number of bytes currently read
    mutable size_t m_bytes_done;

    int _FullCompare(const File& i_other) const;
  };

#endif